import { BrowserModule } from '@angular/platform-browser';
import { APP_INITIALIZER, NgModule } from '@angular/core';
import { AxiosService } from './axios.service';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { LoginComponent } from './component/login/login.component';
import { NgZorroAntdModule, NZ_I18N, zh_CN} from 'ng-zorro-antd';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { HomeComponent } from './component/home/home.component';
import { PermissionsComponent } from './component/permissions/permissions.component';
import { AuditComponent } from './component/audit/audit.component';
import { DesignComponent } from './component/design/design.component';
// import { EmpHomeComponent } from './component/emp-home/emp-home.component';
import { EmpDesignComponent } from './component/emp-design/emp-design.component';
import { EmpProgramComponent } from './component/emp-program/emp-program.component';
import { EmpProcessComponent } from './component/emp-process/emp-process.component';
import { EmpKufangComponent } from './component/emp-kufang/emp-kufang.component';
import { EmpZhijianComponent } from './component/emp-zhijian/emp-zhijian.component';
import { EmpZuzhuangComponent } from './component/emp-zuzhuang/emp-zuzhuang.component';
import { EmpZongjianComponent } from './component/emp-zongjian/emp-zongjian.component';
// import { EmpChuhuoComponent } from './component/emp-chuhuo/emp-chuhuo.component';
// import { EmpYanshouComponent } from './component/emp-yanshou/emp-yanshou.component';
import { PermissionsUserinfoComponent } from './component/permissions-userinfo/permissions-userinfo.component';
import { PermissionsCNCComponent } from './component/permissions-cnc/permissions-cnc.component';
import { KufangComponent } from './component/kufang/kufang.component';
import { ProcessComponent } from './component/process/process.component';
import { ProgramComponent } from './component/program/program.component';
import { YanshouComponent } from './component/yanshou/yanshou.component';
import { ZhijianComponent } from './component/zhijian/zhijian.component';
import { ZuzhuangComponent } from './component/zuzhuang/zuzhuang.component';
import { JiagongComponent } from './component/jiagong/jiagong.component';
import { CNCComponent } from './component/cnc/cnc.component';
import { EmpJiagongComponent } from './component/emp-jiagong/emp-jiagong.component';
import { ZhijianChildComponent } from './component/zhijian-child/zhijian-child.component';
import { PermissionsCNCjiagongComponent } from './component/permissions-cncjiagong/permissions-cncjiagong.component';
import { RukuComponent } from './component/ruku/ruku.component';
import { PaijianComponent } from './component/paijian/paijian.component';
import { LingliaoComponent } from './component/lingliao/lingliao.component';
import { WuliaofafangComponent } from './component/wuliaofafang/wuliaofafang.component';
import { RukuManageComponent } from './component/ruku-manage/ruku-manage.component';
import { BeipinmsgComponent } from './component/beipinmsg/beipinmsg.component';
import { ChangshangmsgComponent } from './component/changshangmsg/changshangmsg.component';
import { ManageRukuComponent } from './component/manage-ruku/manage-ruku.component';
import { KanbanManageComponent } from './component/kanban-manage/kanban-manage.component';
import { BaobiaoComponent } from './component/baobiao/baobiao.component';
import { ZongjihuaComponent } from './component/zongjihua/zongjihua.component';
import { DesignProcessComponent } from './component/design-process/design-process.component';
import { ProgramProcessComponent } from './component/program-process/program-process.component';
import { JiagongProcessComponent } from './component/jiagong-process/jiagong-process.component';
import { ZuzhuangProcessComponent } from './component/zuzhuang-process/zuzhuang-process.component';
import { PinjianProcessComponent } from './component/pinjian-process/pinjian-process.component';
import { BeiliaoProcessComponent } from './component/beiliao-process/beiliao-process.component';
import { ZongjianProcessComponent } from './component/zongjian-process/zongjian-process.component';
import { PaibanComponent } from './component/paiban/paiban.component';
import { AutoPaibanComponent } from './component/auto-paiban/auto-paiban.component';
import { AddtaskComponent } from './component/addtask/addtask.component';
import { PaibansetComponent } from './component/paibanset/paibanset.component';
import { ZjfsComponent } from './component/zjfs/zjfs.component';
import { LirunComponent } from './component/lirun/lirun.component';
import { ZhijvleixingsetComponent } from './component/zhijvleixingset/zhijvleixingset.component';
import { DeleteComponent } from './component/delete/delete.component';
import { HttpClientModule } from '@angular/common/http';
import { ConfigServiceService } from './configService.service';


export function configureProvider(loader: ConfigServiceService): () => Promise<void> {
  return async () => {
    await loader.loadConfigure([
      { path: 'assets/config/config.json', type: 'datasources' }
    ]);
  };
}

registerLocaleData(zh);

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    HomeComponent,
    PermissionsComponent,
    AuditComponent,
    DesignComponent,
    // EmpHomeComponent,
    EmpDesignComponent,
    EmpProgramComponent,
    EmpProcessComponent,
    EmpKufangComponent,
    EmpZhijianComponent,
    EmpZuzhuangComponent,
    EmpZongjianComponent,
    // EmpChuhuoComponent,
    // EmpYanshouComponent,
    PermissionsUserinfoComponent,
    PermissionsCNCComponent,
    KufangComponent,
    ProcessComponent,
    ProgramComponent,
    YanshouComponent,
    ZhijianComponent,
    ZuzhuangComponent,
    JiagongComponent,
    CNCComponent,
    EmpJiagongComponent,
    ZhijianChildComponent,
    PermissionsCNCjiagongComponent,
    RukuComponent,
    PaijianComponent,
    LingliaoComponent,
    WuliaofafangComponent,
    RukuManageComponent,
    BeipinmsgComponent,
    ChangshangmsgComponent,
    ManageRukuComponent,
    KanbanManageComponent,
    BaobiaoComponent,
    ZongjihuaComponent,
    DesignProcessComponent,
    ProgramProcessComponent,
    JiagongProcessComponent,
    ZuzhuangProcessComponent,
    PinjianProcessComponent,
    BeiliaoProcessComponent,
    ZongjianProcessComponent,
    PaibanComponent,
    AutoPaibanComponent,
    AddtaskComponent,
    PaibansetComponent,
    ZjfsComponent,
    LirunComponent,
    ZhijvleixingsetComponent,
    DeleteComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    NgZorroAntdModule,
    FormsModule,
    BrowserAnimationsModule,
    HttpClientModule
  ],
  providers: [
    { provide: NZ_I18N, useValue: zh_CN },
    {
      provide: APP_INITIALIZER,
      useFactory: configureProvider,
      deps: [ConfigServiceService],
      multi: true
    },
    AxiosService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
